home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: Special Tips & Tricks for Windows 95
/
Chip Wintips.iso
/
sterown
/
grafika
/
w2p_pd12
/
pd12.ms_
/
pd12.ms
Wrap
Text File
|
1996-04-02
|
26KB
|
792 lines
'**************************************************************************
'* combined setup script for POWERdraft for AutoCAD and POWERdraft for LT
'* original template: MSSetup Toolkit Sample 1
'* includes installation of Win32s subset
'**************************************************************************
'*
'* REV:
'* ??.11.94, mk: merged scripts for R12/Win and LT/Win
'* 25.11.94, mk: added MULTIman as a valid Windows driver name
'* 13.01.95, mk: changed destination for DRWLIB files from DESTSYS to DESTWIN,
' added fix for a bug we only saw in R13 but was reported for
' PD12 by a customer
'* 19.01.95, mk: added the naming scheme for the new Windows drivers
'* 13.03.95, mk: installation of PD12 _and_ PD13 on one machine didn't work
'* 02.04.96, mb: win32s should be installed separately
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's, all LT specific dialogs are offset by 20
CONST LANGUAGE = 50
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST ACADPATH = 300
CONST DESTPATH = 350
CONST DEST_LT = 370
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
'CONST EXITOK = 700
'CONST EXITOK_LT = 720
CONST EXITOK_NOW32 = 750
CONST EXITOK_NW32LT = 770
CONST DRVHELP = 900
'CONST W32SHELP = 1000
CONST W32SMISSING = 1100
CONST W32STOOOLD = 1150
CONST W32SCONFIRM = 1170
CONST EXITFAILNOTWIN31 = 1200
CONST EXITFAILNOTENH = 1300
'CONST EXITFAILNOTPAGING = 1400
CONST EXITFAILOLDDRV = 1500
CONST WILLBREAKOLD = 1600
CONST WILLBREAKNEW = 1650
CONST BADPATH = 6400
''Bitmap ID
CONST LOGO = 1
CONST DRIVERFAMILY = "POWERdraft for AutoCAD"
CONST DRIVERKEY_12 = "WinADIR12"
CONST DRIVERKEY_LT = "WinADILT"
CONST DRIVERNAME_12 = "POWERdraft for AutoCAD R12"
CONST DRIVERNAME_LT = "POWERdraft for AutoCAD LT"
''!! FIXME
CONST MINDRVVER31 = "5.20" '' remember to update dialog EXITFAILOLDDRV!
CONST MINWIN32SVER = "1.25.142.0" '' in system\win32s.ini [Win32s] Version
GLOBAL CUIDLL$ ''name of custom user interface DLL
GLOBAL DEST$ ''Default destination directory.
GLOBAL DESTACAD$ ''ACAD's home directory.
GLOBAL DESTWIN$ ''Windows directory.
GLOBAL DESTSYS$ ''Windows\System directory.
GLOBAL DEST32S$ ''Windows\System\Win32s directory
GLOBAL LANG% ''language code, is added to every dialog ID
GLOBAL ACADLT% ''flag for AutoCAD LT installation
GLOBAL AlwaysCopy% ''special flag to uncoditionally overwrite Win32S
GLOBAL ExitCode% ''global error code
DECLARE SUB Install
DECLARE SUB UpdateELSADisp
DECLARE FUNCTION NeedELSADisp AS INTEGER
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION ExitWindowsExec LIB "USER.EXE" (arg1$, arg2$) AS INTEGER
DECLARE FUNCTION GlobalFindAtom LIB "USER" (arg1$) AS INTEGER
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
CheckWin32s% = 0
Win32sIsOld% = 0
AlwaysCopy% = 0
ExitCode% = EXITFAILURE
ON ERROR GOTO ERRNORMAL
'' build a global list of ELSA system components used by this driver
AddListItem "USES", "DRWh"
AddListItem "USES", "DL32h"
SrcDir$ = GetSymbolValue("STF_SRCDIR")
SetBitmap CUIDLL$, LOGO
SetTitle DRIVERFAMILY
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "PD12.INF"
END IF
ReadInfFile szInf$
LANG% = 0
DEST$ = "C:\WINNER\WINADI\"
DESTWIN$ = GetWindowsDir()
DESTSYS$ = GetWindowsSysDir()
DEST32S$ = DESTSYS$ + "WIN32S\"
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
'$ENDIF ''DEBUG
LANGUAGE:
langstr$ = STR$(LANG% + 1)
SetSymbolValue "RadioDefault", langstr$
LANGL1:
sz$ = UIStartDlg(CUIDLL$, LANGUAGE, "FRadioDlgProc", 0, "")
langstr$ = GetSymbolValue("ButtonChecked")
LANG% = VAL(LANGSTR$) - 1
IF sz$ = "CONTINUE" THEN
UIPop(1)
ELSEIF sz$ = "REACTIVATE" THEN
GOTO LANGL1
ELSE
GOSUB ASKQUIT
GOTO LANGUAGE
END IF
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME+LANG%, "FInfoDlgProc", DRVHELP+LANG%, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO WELCOME
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO LANGUAGE
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
CHECK:
IF GetWindowsMajorVersion <> 3 THEN
ExitCode% = EXITFAILNOTWIN31
GOTO QUIT
END IF
IF GetWindowsMinorVersion < 10 THEN
ExitCode% = EXITFAILNOTWIN31
GOTO QUIT
END IF
IF GetWindowsMinorVersion >= 50 AND GetWindowsMinorVersion < 95 THEN
ExitCode% = EXITFAILNOTWIN31
GOTO QUIT
END IF
IF GetWindowsMode < 2 THEN
ExitCode% = EXITFAILNOTENH '' Standard Mode Windows
GOTO QUIT
END IF
'' check for ELSA display driver running
IF GlobalFindAtom( "ELSA_Driver" ) = 0 THEN
ExitCode% = EXITFAILOLDDRV
GOTO QUIT
END IF
'' windows 95 is o.k. - no need to check the display driver version
IF GetWindowsMinorVersion <> 95 THEN
'' win3.1x
'' get version number of Windows display driver -
'' since it's difficult to check whether multiman is running or not,
'' we only check the driver's version.
'' multiman version is checked at runtime of PD12
ini$ = MakePath( GetWindowsDir(), "SYSTEM.INI" )
DrvVersion$ = LTRIM$(RTRIM$(GetIniKeyString( ini$, "ELSA", "Version" )))
''dummy% = DoMsgBox(":"+DrvVersion$+":"+MINDRVVER31+":", "DEBUG", MB_OK+MB_TASKMODAL+MB_ICONHAND)
IF DrvVersion$ < MINDRVVER31 THEN
ExitCode% = EXITFAILOLDDRV
GOTO QUIT
END IF
'' Win32s needed for Win3.1x
CheckWin32s% = 1
END IF
CHECKDONE:
CHECKWIN32S:
IF CheckWin32s% = 1 THEN
'' Check if Win32s is partially installed
sz$ = GetIniKeyString (DESTSYS$ + "WIN32S.INI", "Win32s", "Setup")
'' If WIN32S.INI is missing or specifies Setup!=0, then install
IF sz$ <> "1" THEN
'' no Win32s
SetSymbolValue "EditTextIn", "abc"
SetSymbolValue "EditFocus", "END"
sz$ = UIStartDlg(CUIDLL$, W32SMISSING+LANG%, "FEditDlgProc", DRVHELP+LANG%, HELPPROC$)
ERROR STFQUIT
END IF
'' If Win32s is already installed, get running version number
szOldVer$ = GetIniKeyString(DESTSYS$ + "WIN32S.INI", "Win32s", "Version")
IF szOldVer$ < MINWIN32SVER THEN
'' Win32s is too old
Win32sIsOld% = 1
WIN32SOLD:
SetSymbolValue "EditTextIn", szOldVer$
SetSymbolValue "EditFocus", "END"
WIN32SOLDL1:
sz$ = UIStartDlg(CUIDLL$, W32STOOOLD+LANG%, "FEditDlgProc", DRVHELP+LANG%, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
WIN32SOLDL2:
sz$ = UIStartDlg(CUIDLL$, W32SCONFIRM+LANG%, "FInfoDlgProc", DRVHELP+LANG%, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
GOTO WIN32SDONE
ELSEIF sz$ = "REACTIVATE" THEN
GOTO WIN32SOLDL2
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WIN32SOLDL1
ELSE
UIPop 1
ERROR STFQUIT
END IF
ELSEIF sz$ = "REACTIVATE" THEN
GOTO WIN32SOLDL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
UIPop 1
ERROR STFQUIT
END IF
END IF
END IF
WIN32SDONE:
'' try to find AutoCAD, if it fails keep string empty
'' typical entry in WIN.INI is:
'' [Extensions]
'' dwg=D:\ACAD\R12C1WUS\acad.exe ^.dwg
'' or
'' dwg=D:\ACAD\LTWIN\aclt.exe ^.dwg
DESTACAD$ = UCASE$( GetIniKeyString( "WIN.INI", "Extensions", "dwg" ) )
IF INSTR( DESTACAD$, "\ACAD.EXE" ) <> 0 THEN
DESTACAD$ = MID$( DESTACAD$, 1, INSTR( DESTACAD$, "\ACAD.EXE" ) )
ELSEIF INSTR( DESTACAD$, "\ACLT.EXE" ) <> 0 THEN
DESTACAD$ = MID$( DESTACAD$, 1, INSTR( DESTACAD$, "\ACLT.EXE" ) )
END IF
GETACAD:
SetSymbolValue "EditTextIn", DESTACAD$
SetSymbolValue "EditFocus", "END"
GETACADL1:
sz$ = UIStartDlg(CUIDLL$, ACADPATH+LANG%, "FEditDlgProc", DRVHELP+LANG%, HELPPROC$)
DESTACAD$ = LTRIM$(RTRIM$(UCASE$( GetSymbolValue("EditTextOut") )))
IF DESTACAD$ = "" THEN
GOSUB BADPATH
GOTO GETACADL1
END IF
IF MID$(DESTACAD$, LEN(DESTACAD$), 1) <> "\" THEN
DESTACAD$ = DESTACAD$ + "\"
END IF
IF sz$ = "CONTINUE" THEN
IF DoesDirExist(DESTACAD$) = 0 THEN
GOSUB BADPATH
GOTO GETACADL1
END IF
IF DoesFileExist( DESTACAD$ + "ACAD.EXE", femExist ) THEN
ACADLT% = 0
'' R13 has no ACAD.DLL
IF DoesFileExist( DESTACAD$ + "ACAD.DLL", femExist ) = 0 THEN
GOSUB BADPATH
GOTO GETACADL1
END IF
ELSEIF DoesFileExist( DESTACAD$ + "ACLT.EXE", femExist ) THEN
ACADLT% = 1
IF IsDirWritable(DESTACAD$) = 0 THEN
GOSUB BADPATH
GOTO GETACADL1
END IF
ELSE
GOSUB BADPATH
GOTO GETACADL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETACADL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
IF Win32sIsOld% = 1 THEN
GOTO WIN32SOLD
ELSE
GOTO WELCOME
END IF
ELSE
GOSUB ASKQUIT
GOTO GETACAD
END IF
GETPATH:
IF ACADLT% = 1 THEN
DEST$ = DESTACAD$
sz$ = UIStartDlg(CUIDLL$, DEST_LT+LANG%, "FEditDlgProc", DRVHELP+LANG%, HELPPROC$)
ELSE
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH+LANG%, "FEditDlgProc", DRVHELP+LANG%, HELPPROC$)
DEST$ = LTRIM$(RTRIM$(UCASE$( GetSymbolValue("EditTextOut") )))
IF DEST$ = "" THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
IF MID$(DEST$, LEN(DEST$), 1) <> "\" THEN
DEST$ = DEST$ + "\"
END IF
END IF
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETACAD
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
CHECKDISP:
IF NeedELSADisp() = -1 THEN
ExitCode% = EXITQUIT
GOTO QUIT
END IF
DOINSTALL:
Install
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = ExitCode%
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ExitCode% = EXITQUIT
ELSE
i% = DoMsgBox("Internal error: "+ERROR$ +" ("+STR$(i%-8)+") in line "+STR$(ERL), "Runtime error", MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
dlg% = EXITFAILURE
ExitCode% = EXITQUIT
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%+LANG%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
'*****************************************************************************
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call your dealer!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
'' Bypass run-time errors. Let final dialog box display fatal error message.
ERRNORMAL:
'' Check if user cancelled setup
IF ERR = STFQUIT THEN
GOTO QUIT
END IF
RESUME NEXT
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH+LANG%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT+LANG%, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
ExitCode% = EXITFAILURE
SrcDir$ = GetSymbolValue("STF_SRCDIR")
'' let's start with POWERdraft files
CreateDir DEST$, cmoNone
OpenLogFile DEST$ + "PD12.LOG", 0
WriteToLogFile ""
WriteToLogFile " Source directory: '" + SrcDir$ + "'"
WriteToLogFile " Destination directory: '" + DEST$ + "'"
WriteToLogFile " AutoCAD directory: '" + DESTACAD$ + "'"
WriteToLogFile " Windows directory: '" + DESTWIN$ + "'"
WriteToLogFile " Windows sys directory: '" + DESTSYS$ + "'"
WriteToLogFile ""
'' Gimme a second, need to clean up a problem of early SETUPs
IF IsWindowsNT% = 0 THEN
WriteToLogFile "'' fix wrong installation of early SETUP versions"
FOR i%=1 TO GetListLength("USES") STEP 1
Component$ = GetListItem( "USES", i% )
MakeListFromSectionFilename "MOVEFILES", Component$
FOR j%=1 TO GetListLength("MOVEFILES") STEP 1
szFile$ = GetListItem( "MOVEFILES", j% )
IF DoesFileExist(DESTSYS$ + szFile$,femExist) THEN
CopyFile DESTSYS$ + szFile$, DESTWIN$ + szFile$, cmoNone,0
RemoveFile DESTSYS$ + szFile$, cmoNone
END IF
NEXT j%
RemoveSymbol "MOVEFILES"
NEXT i%
END IF
AddSectionFilesToCopyList DRIVERKEY_12, SrcDir$, DEST$
FOR i%=1 TO GetListLength("USES") STEP 1
Component$ = GetListItem( "USES", i% )
AddSectionFilesToCopyList Component$, SrcDir$, DESTWIN$
NEXT i%
''!! debugging aid: DumpCopyList DEST$ + "PD12.LST"
CopyFilesInCopyList
IF ERR <> 0 THEN
EXIT SUB
END IF
IF ACADLT% = 1 THEN
'' keep AutoCAD's driver by renaming, put our's in place
IF DoesFileExist(DEST$ + "acltds_o.dll",femExists) = 0 THEN
RenameFile DEST$ + "acltds.dll", "acltds_o.dll"
ELSE
RemoveFile DEST$ + "acltds.dll", cmoNone
END IF
RenameFile DEST$ + "dselsa.dll", "acltds.dll"
END IF
'' if copy succeeded, do all INI changes, first for POWERdraft ...
ini$ = DESTWIN$ + "DSELSA.INI"
CreateIniKeyValue ini$, "Options", "Autostart", "Cockpit^s", cmoNone
'' maintain our ELSADISP.INI
UpdateELSADisp
IF DESTACAD$ <> "" THEN
IF ACADLT% = 1 THEN
ini$ = MakePath(DESTACAD$, "ACLT.INI")
acadsect$ = "AutoCAD LT General"
ELSE
ini$ = MakePath(DESTACAD$, "ACAD.INI")
acadsect$ = "AutoCAD General"
END IF
IF ACADLT% = 0 THEN
'' append destination path to AutoCAD's key ACADDRV in ACAD.INI
acaddrv$ = UCASE$( GetIniKeyString( ini$, acadsect$, "ACADDRV" ) )
IF INSTR( acaddrv$, DEST$ ) = 0 THEN
acaddrv$ = acaddrv$ + ";" + DEST$
END IF
CreateIniKeyValue ini$, acadsect$, "ACADDRV", acaddrv$, cmoOverwrite
END IF
IF GetIniKeyString( ini$, acadsect$, "ToolBar1" ) = "" THEN
' they have a built in default of 17 buttons
CreateIniKeyValue ini$, acadsect$, "ToolBar18", "'Cockpit #C", cmoOverwrite
CreateIniKeyValue ini$, acadsect$, "ToolBar19", "'MagniView #M", cmoOverwrite
ELSE
' user already changed buttons that made ACAD write list to ini file
FOR i%=1 TO 26 STEP 1
tb_key$ = "ToolBar" + LTRIM$(RTRIM$( STR$(i) ))
tb_val$ = UCASE$( GetIniKeyString( ini$, acadsect$, tb_key$ ) )
IF INSTR( tb_val$, "COCKPIT" ) THEN
EXIT FOR
END IF
IF tb_val$ = "" THEN
CreateIniKeyValue ini$, acadsect$, tb_key$, "'Cockpit #C", cmoOverwrite
EXIT FOR
END IF
NEXT i%
FOR i%=1 TO 26 STEP 1
tb_key$ = "ToolBar" + LTRIM$(RTRIM$( STR$(i) ))
tb_val$ = UCASE$( GetIniKeyString( ini$, acadsect$, tb_key$ ) )
IF INSTR( tb_val$, "MAGNIVIEW" ) THEN
EXIT FOR
END IF
IF tb_val$ = "" THEN
CreateIniKeyValue ini$, acadsect$, tb_key$, "'MagniView #M", cmoOverwrite
EXIT FOR
END IF
NEXT i%
END IF
END IF
'' put a help file icon into AutoCAD group in ProgMangler
IF LANG%=1 THEN
helpfile$ = DEST$ + "lang_de.hlp"
ELSE
helpfile$ = DEST$ + "lang_en.hlp"
END IF
IF ACADLT% = 1 THEN
CreateProgmanItem "AutoCAD LT", DRIVERNAME_LT, helpfile$, "", cmoOverwrite
ELSE
CreateProgmanItem "AutoCAD", DRIVERNAME_12, helpfile$, "", cmoOverwrite
END IF
IF ACADLT% = 1 THEN
ExitCode% = EXITOK_NW32LT
ELSE
ExitCode% = EXITOK_NOW32
END IF
CloseLogFile
END SUB
'**
'** Purpose:
'** Check versions of our system components and handle compatibility
'** conflicts
'** Arguments:
'** -
'** Returns:
'** 0 for no install needed, 1 for install required, -1 for abort
'*************************************************************************
FUNCTION NeedELSADisp STATIC AS INTEGER
ReturnValue% = 1
IF ACADLT=1 THEN
DriverName$ = DRIVERNAME_LT
ELSE
DriverName$ = DRIVERNAME_12
END IF
'' we have version numbers of all components in our INI file ELSADISP.INI
'' use this to check for incompatible updates
ELSAdisp$ = DESTWIN$ + "ELSADISP.INI"
IF DoesFileExist(ELSAdisp$,femExist) THEN
IF DoesFileExist(ELSAdisp$,femReadWrite) = 0 THEN
i% = DoMsgBox( "ABORT: " + ELSAdisp$ + " is write protected!", "Fatal Error", MB_ICONSTOP+MB_TASKMODAL)
NeedELSADisp = -1
EXIT FUNCTION
END If
END IF
'' Check versions of system components,
'' use the file marked "VERCHECK" in each group
FOR i%=1 TO GetListLength("USES") STEP 1
Component$ = GetListItem( "USES", i% )
usedby$ = GetIniKeyString( ELSAdisp$, Component$, "UsedBy" )
'' get compatibility levels
szNewVer$ = GetSectionKeyVersion(Component$,"VERCHECK")
szOldVer$ = GetVersionOfFile( DESTWIN$ + GetSectionKeyFileName(Component$,"VERCHECK") )
'' Once upon a time we had a broken SETUP ...
'' that installed to DESTSYS instead of DESTWIN, so look there too,
'' we will move the files in subroutine Install
IF szOldVer$ = "" THEN
szOldVer$ = GetVersionOfFile( DESTSYS$ + GetSectionKeyFileName(Component$,"VERCHECK") )
END IF
'' can not be incompatible if it is not installed ...
IF szOldVer$ <> "" THEN
szNewLev& = GetVersionNthField( szNewVer$, 1 )
szOldLev& = GetVersionNthField( szOldVer$, 1 )
'' remember incompatible components in a list
IF szNewLev& <> szOldLev& THEN
AddListItem "COMPLEVEL", Component$
ReturnValue% = 2
ENDIF
'' build list of broken apps
FOR j% = 1 TO 999 STEP 1
app$ = GetNthFieldFromIniString( usedby$, j% )
IF app$ = "" THEN
EXIT FOR
END IF
AppName$ = GetIniKeyString( ELSAdisp$, app$, "FullName" )
IF szNewLev& > szOldLev& THEN
''add every app only once ...
IF INSTR(OldApps$,AppName$) = 0 THEN
''... and never ourselves
IF AppName$<>DriverName$ THEN
OldApps$ = OldApps$ + AppName$ + ";"
END IF
END IF
ELSEIF szNewLev& < szOldLev& THEN
'' oh shit, we are really old!
IF INSTR( NewApps$, AppName$ ) = 0 THEN
IF AppName$<>DriverName$ THEN
NewApps$ = NewApps$ + AppName$ + ";"
END IF
END IF
END IF
NEXT j%
END IF
NEXT i%
IF OldApps$ <> "" THEN
BROKENOLD:
''convert our string delimited with ";" into a Symbol table list
RemoveSymbol "ListItemsIn"
WHILE OldApps$ <> ""
i% = INSTR( OldApps$, ";" )
AppName$ = MID$( OldApps$, 1, i%-1 )
AddListItem "ListItemsIn", AppName$
OldApps$ = MID$( OldApps$, i%+1 )
WEND
sz$ = UIStartDlg(CUIDLL$, WILLBREAKOLD+LANG%, "FListDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO BROKENOLD
ELSE
UIPop 1
ReturnValue% = -1
END IF
END IF
IF NewApps$ <> "" THEN
BROKENNEW:
RemoveSymbol "ListItemsIn"
WHILE NewApps$ <> ""
i% = INSTR( NewApps$, ";" )
AppName$ = MID$( NewApps$, 1, i%-1 )
AddListItem "ListItemsIn", AppName$
NewApps$ = MID$( NewApps$, i%+1 )
WEND
sz$ = UIStartDlg(CUIDLL$, WILLBREAKNEW+LANG%, "FListDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO BROKENNEW
ELSE
UIPop 1
ReturnValue% = -1
END IF
END IF
'' If user decided to continue installation (breaking another app)
'' delete the old system files to make sure they will be copied.
'' Otherwise the filedate check would not allow to install older files.
IF ReturnValue% = 2 THEN
FOR i%=1 TO GetListLength("COMPLEVEL") STEP 1
Component$ = GetListItem( "COMPLEVEL", i% )
MakeListFromSectionFilename "COMPFILES", Component$
FOR j%=1 TO GetListLength("COMPFILES") STEP 1
szFile$ = DESTWIN$ + GetListItem( "COMPFILES", j% )
IF DoesFileExist(szFile$,femReadWrite) THEN
RemoveFile szFile$, cmoVital
END IF
NEXT j%
RemoveSymbol "COMPFILES"
NEXT i%
RemoveSymbol "COMPLEVEL"
ReturnValue% = 1
END IF
NeedELSADisp = ReturnValue%
END FUNCTION
'**
'** Purpose:
'** Create or update ELSADISP.INI, this is where we note cross
'** dependencies and support detection of version conflicts.
'** Arguments:
'** -
'** Returns:
'** -
'*************************************************************************
SUB UpdateELSADisp STATIC
IF ACADLT=1 THEN
DriverName$ = DRIVERNAME_LT
DriverKey$ = DRIVERKEY_LT
ELSE
DriverName$ = DRIVERNAME_12
DriverKey$ = DRIVERKEY_12
END IF
'' save version numbers of all components to our INI file ELSADISP.INI
'' this can be used to check for incompatible updates, see NeedELSADisp()
ELSAdisp$ = DESTWIN$ + "ELSADISP.INI"
szNewVer$ = GetSectionKeyVersion(DRIVERKEY_12,"VERCHECK")
CreateIniKeyValue ELSAdisp$, DriverKey$, "Version", szNewVer$, cmoOverwrite
CreateIniKeyValue ELSAdisp$, DriverKey$, "FullName", DriverName$, cmoOverwrite
uses$ = ""
FOR i%=1 TO GetListLength("USES") STEP 1
Component$ = GetListItem( "USES", i% )
uses$ = uses$ + "," + Component$
szNewVer$ = GetSectionKeyVersion(Component$,"VERCHECK")
CreateIniKeyValue ELSAdisp$, Component$, "Version", szNewVer$, cmoOverwrite
usedby$ = GetIniKeyString( ELSAdisp$, Component$, "UsedBy" )
IF usedby$ = "" THEN
usedby$ = DriverKey$
ELSEIF INSTR( usedby$, DriverKey$ ) = 0 THEN
usedby$ = usedby$ + "," + DriverKey$
END IF
CreateIniKeyValue ELSAdisp$, Component$, "UsedBy", usedby$, cmoOverwrite
NEXT i%
CreateIniKeyValue ELSAdisp$, DriverKey$, "Uses", MID$(uses$,2), cmoOverwrite
END SUB
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION